package controlador;
import java.awt.Color;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.sql.ResultSet;
import java.sql.SQLException;

import modelo.Clave;
import vista.VistaClaveAdmin;

public class ControladorClave implements ActionListener{
	private VistaClaveAdmin acc;
	
	public ControladorClave() {
		super();
		this.acc = new VistaClaveAdmin();
		this.acc.addlistener(this);
	    this.acc.setVisible(true);
	    acc.getContentPane().setBackground(Color.white);
	    acc.setLocationRelativeTo(null);
	}
  
    public void actionPerformed(ActionEvent e) {
	  
	  if (e.getActionCommand().equals("Aceptar")) 
	  {
	      Clave ac= new Clave();   
		  if (acc.gettxtlog().getText().equals("")||acc.gettxtpass().getText().equals(""))
			 acc.mostrarMensaje("debe llenar ambos campos");
	      else if (acc.gettxtlog().getText().equals(ac.getLog())||acc.gettxtpass().getText().equals(ac.getPass()))
	    {
			acc.dispose();
			new ControladorAdministrador(null);         	
	    }
	    else acc.mostrarMensaje("Usuario o password incorrecto"); 
	    	
      }		  		  	 	  
    }
}